package com.biye.api.controller.admin;

import com.alibaba.fastjson.JSONObject;
import com.biye.api.service.ExcelImportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;

@Controller
@RequestMapping("admin")
public class UploadController {

    @Autowired
    private ExcelImportService excelImportService;

    @ResponseBody
    @RequestMapping(value = "infoImport", method = RequestMethod.POST)
    public JSONObject FileUpload1(@RequestParam("upfile") MultipartFile uploadFile, HttpServletRequest request) throws ParseException {
        return excelImportService.importStuAndTeaInfo(uploadFile, request);
    }

}
